package com.ztgf.logistics.api.cms;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.ztgf.common.constant.Result;
import com.ztgf.logistics.models.bo.CourierCompanyBO;
import com.ztgf.logistics.models.dto.CourierCompanyDTO;
import com.ztgf.logistics.models.service.ICourierCompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 快递公司信息表控制器
 *
 * @author chenyu.wang
 * @Date 2020-06-29 11:09:27
 */

@RestController
@RequestMapping("/cms/courierCompany")
@Slf4j
@Api(value = "CourierCompanyController", tags = "快递公司信息表接口")
public class CourierCompanyController {

    @DubboReference
    private ICourierCompanyService courierCompanyService;

    @PostMapping("/queryPageList")
    @ApiOperation(value = "快递公司信息表列表", notes = "快递公司信息表列表")
    public Result<Page<CourierCompanyDTO>> queryPageList(CourierCompanyBO bo) {
        Wrapper<CourierCompanyDTO> wrapper = new EntityWrapper<>();
        Page<CourierCompanyDTO> page = new Page<>(bo.getPageNo(), bo.getPageSize());
        page = courierCompanyService.selectPage(page, wrapper);
        return new Result<>(page);
    }

    @PostMapping("/queryPageListBySys")
    @ApiOperation(value = "快递公司信息表列表", notes = "快递公司信息表列表")
    public Result queryPageListBySys() {
        Wrapper<CourierCompanyDTO> wrapper = new EntityWrapper<>();
        return new Result<>(courierCompanyService.selectList(wrapper));
    }
}
